package com.guan.controller;

import com.guan.core.BaseController;
import com.guan.core.CustomView;
import com.guan.core.annotation.Autowired;
import com.guan.core.annotation.Controller;
import com.guan.core.annotation.RequestMapping;
import com.guan.core.entity.Page;
import com.guan.core.entity.PageData;
import com.guan.service.ProductService;
import org.apache.log4j.Logger;

/**
 * 商品控制类
 * Created by Administrator on 2018/1/28 0028.
 */
@Controller
@RequestMapping("/product")
public class ProductController extends BaseController{
    protected Logger log = Logger.getLogger(ProductController.class);
    @Autowired("productService")
    private ProductService productService;

    /**
     * 查询全部商品
     * @return
     */
    @RequestMapping("/list")
    public CustomView list(){
        log.debug("进入查询商品方法");
        PageData pageData = this.getPageDate();//拿到页面的参数
        Page<PageData> page = new Page<PageData>();//初始化分页对象
        page.setPd(pageData);
        page = productService.queryProductType(page);
        put("page",page);
        return new CustomView("/product/list");
    }
}
